.TH ecvtbuf 3 "" "" ""
.SH SYNOPSIS
ecvtbuf, fcvtbuf \- double or float to string
.SH ANSI_SYNOPSIS
#include <stdio.h>
.br

char *ecvtbuf(double 
.IR val ,
int 
.IR chars ,
int *
.IR decpt ,
.br
int *
.IR sgn ,
char *
.IR buf );
.br

char *fcvtbuf(double 
.IR val ,
int 
.IR decimals ,
int *
.IR decpt ,
.br
int *
.IR sgn ,
char *
.IR buf );
.br
.SH TRAD_SYNOPSIS
#include <stdio.h>
.br

char *ecvtbuf(
.IR val ,
.IR chars ,
.IR decpt ,
.IR sgn ,
.IR buf );
.br
double 
.IR val ;
.br
int 
.IR chars ;
.br
int *
.IR decpt ;
.br
int *
.IR sgn ;
.br
char *
.IR buf ;
.br

char *fcvtbuf(
.IR val ,
.IR decimals ,
.IR decpt ,
.IR sgn ,
.IR buf );
.br
double 
.IR val ;
.br
int 
.IR decimals ;
.br
int *
.IR decpt ;
.br
int *
.IR sgn ;
.br
char *
.IR buf ;
.br
.SH DESCRIPTION
.BR ecvtbuf 
and 
.BR fcvtbuf 
produce (null-terminated) strings
of digits representating the 
.BR double 
number 
.IR val .

The only difference between 
.BR ecvtbuf 
and 
.BR fcvtbuf 
is the
interpretation of the second argument (
.IR chars 
or
.IR decimals ).
For 
.BR ecvtbuf ,
the second argument 
.IR chars 
specifies the total number of characters to write (which is
also the number of significant digits in the formatted string,
since these two functions write only digits). For 
.BR fcvtbuf ,
the second argument 
.IR decimals 
specifies the number of
characters to write after the decimal point; all digits for
the integer part of 
.IR val 
are always included.

Since 
.BR ecvtbuf 
and 
.BR fcvtbuf 
write only digits in the
output string, they record the location of the decimal point
in 
.BR *<[decpt >>,
and the sign of the number in 
.BR *<[sgn >>.
After formatting a number, 
.BR *<[decpt >>
contains the number
of digits to the left of the decimal point. 
.BR *<[sgn >>
contains 
.BR 0 
if the number is positive, and 
.BR 1 
if it is
negative. For both functions, you supply a pointer 
.IR buf 
to
an area of memory to hold the converted string.
.SH RETURNS
Both functions return a pointer to 
.IR buf ,
the string
containing a character representation of 
.IR val .
.SH PORTABILITY
Neither function is ANSI C.

Supporting OS subroutines required: 
.BR close ,
.BR fstat ,
.BR isatty ,
.BR lseek ,
.BR read ,
.BR sbrk ,
.BR write .
.SH SOURCE
src/newlib/libc/stdlib/ecvtbuf.c
